package com.kang.aop;

import com.kang.config.BotConfig;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @author K.faWu
 * @program service
 * @description: 切面处理类
 * @create 2022-08-04 16:25
 **/
@Aspect
@Component
@Slf4j
public class BotAspect {


    /**
     * 判断机器人是否启动
     */
    @Around("execution(* com.kang.listener..*.*(..))")
    public Object botListener(ProceedingJoinPoint point) throws Throwable {
        Object result = null;
        if (BotConfig.getBotState()) {
             result = point.proceed();
        }
        return result;
    }
}
